//
//  ADView.h
//  HuiShangBaoApp
//
//  Created by chenzhihui on 13-8-16.
//  Copyright (c) 2013年 青岛晨之辉信息服务有限公司. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "ADModel.h"
#import "MyPageControl.h"

typedef void(^ScrollViewTouch) (NSInteger index);

@interface ADView : UIView<UIScrollViewDelegate>
{
    //滚动图片的数量
    NSInteger _num;
    //图片名字的数组
    NSArray *_images;
    //滚动图片的大小
    CGSize _imageSize;
    
    //第一张图片的x、y坐标
    CGFloat _imageX;
    CGFloat _imageY;
    
    //判断是否横向滚动
    BOOL _horizontal;
    
    //动画间隔时间
    CGFloat _animationTime;
    
    //开始、结束动画
    BOOL _startAnimation;
    
    //设置定时器
    NSTimer *_timer;
    
    //当前页数
    NSInteger _currentPage;
    
    ScrollViewTouch _touchBlock;
    
}

@property (nonatomic, assign) BOOL horizontal;
@property (nonatomic, assign) CGFloat animationTime;
@property (nonatomic, assign) BOOL startAnimation;
@property (nonatomic, assign) BOOL stopAnimation;
@property (strong,nonatomic) MyPageControl *pageControl;
@property(strong,nonatomic)UIScrollView *aDScrollView;
@property (nonatomic, assign) float halfGap;   // 图片间距的一半
@property (strong,nonatomic) UIColor * imageColor;
@property (strong, nonatomic) NSMutableArray * imageViewArray;

- (id)initWithFrame:(CGRect)frame
         WithNumber:(NSInteger)num
     WithImageFrame:(CGSize)imageSize
     WithHorizontal:(BOOL)horizontal
  WithAnimationTime:(CGFloat)animationTime;
-(void)addPageControl;
/*
 *开启或结束自动动画
 */
- (void)startAnimation:(BOOL)start;

/*
 *通过图片的URL设置广告图的位置
 */
- (void)initImageViewWithImagesURL:(NSArray *)imagesURL andPlaceholderImageName:(NSString *)placeholderName;
//图片不适配自身大小
- (void)initNOFitImageViewWithImagesURL:(NSArray *)imagesURL andPlaceholderImageName:(NSString *)placeholderName;
/*
 *通过图片的名称设置广告图的位置
 */
- (void)initImageViewWithImageNames:(NSArray *)imageNames;

/*
 *UIScrollView上某张图的点击触发方法
 */
- (void)clickOneImage:(ScrollViewTouch)touchBlock;

/*
 *设置广告信息
 */
- (void)initAdImageView:(NSString *)title
              WithFrame:(CGRect)frame
               WithView:(id)view
         WithTitleColor:(UIColor *)color
               WithFont:(UIFont *)font;

-(void)loadADViewWithNumber:(NSInteger)num WithImageFrame:(CGSize)imageSize WithHorizontal:(BOOL)horizontal WithAnimationTime:(CGFloat)animationTime;

@end
